Writing Control Panel Files
You should keep the following points in mind if you are writing or modifying a
control panel file:
• A control panel file displays a modeless dialog box with no menu bar.
You can use the editing functions in the Finder's menu bar if necessary,
but you cannot add any menu choices. The Finder passes messages to
your cdev function for the following standard selections from the Edit menu: Undo, Cut, Copy, Paste, and Clear. Your cdev function can respond to these messages when it is appropriate to do so; for example,
if your control panel has an editable text box, you can respond to these
editing functions when the insertion point is within this field.
• The rectangles defined by the 'nrct' resource are no longer restricted
to the size of the Control Panel; however, to maintain compatibility with previous operating systems, the rectangles' coordinates should not
exceed (-1,87,255,322).
• There is no longer a guarantee that the resources provided by the
running. If your control panel file uses any Control Panel resources, it might not run in System 7.0. If your control panel file strictly
follows the specifications in the Control Panel chapter of Volume V, however, it should run with no difficulty in System 7.0 (or later).
• Your control panel file can continue to use the CPDialog parameter
passed to the cdev function to obtain the dialog item list and the numItems parameter to determine the number of items in the dialog
item list. If you use these parameters in your control panel file to gain
access to the items in your dialog item list, your control panel file will
operate correctly with both the Control Panel and the Finder. If you assume some value for the numItems parameter, however, your
control panel file will not operate correctly in both situations. Dialog
• If the 'mach' resource in your control panel file indicates that the
cdev function cannot run, the Finder displays an error message for the user and does not open the control panel file. In contrast, the
Control Panel does not display the icon for a control panel file if the 'mach' resource indicates the cdev function cannot run. If your control panel file can run on all Macintosh computers, set the 'mach'
resource to $FFFF 0000. If your control panel file can run only when
certain hardware or software is present, set the 'mach' resource to
$0000 FFFF. In the latter case, the Finder calls your cdev function with the message parameter set to the constant macDev (8). Your cdev function should then call the Gestalt function to determine the software and hardware configuration of the machine. If your control
panel file cannot run, return a result code of 0; if your control panel
file can run, return a result code of 1. The Gestalt function is • The Finder now handles the result codes returned by your cdev panel file in response to certain result codes, the Finder displays an
error message but does not dim the control panel file icon.
• Under System 7, the 'fwst' resource type is used to allow the Finder to
keep track of the position of a control panel window on the screen.
When a user opens a control panel, moves its window, and then closes it,
a 'fwst' resource is added to the control panel file. This tells the Finder
where to place the window next time it is opened. If you scan your
resource fork for viruses, you need to know that the sudden appearance
of this 'fwst' resource is normal, and not a viral infection or symptom
of a damaged resource fork. The other important thing is know is that
the 'fwst' takes precedence over the 'nrct' resource, so if you need to
change your 'nrct', you must first delete the 'fwst' (using a resource
editor such as ResEdit) or your changes will not take effect. Be sure to
delete the 'fwst' before shipping your control panel, to allow it to come
up in the default position.